<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="/static/plugs/jquery-3.4.1/jquery-3.4.1.min.js"></script>
    <script src="/static/plugs/qrcode/jquery.qrcode.min.js"></script>
</head>
<body>
    <div id="code"></div>
  
    <script>
        $(function(){
            $("#code").qrcode({
                render: "table", //table方式
                width: 200, //宽度
                height:200, //高度
                text: "http://www.baidu.com?uid=99" //任意内容
            });

            ws = new WebSocket("ws://127.0.0.1:2347");
            ws.onopen = function() {
                console.log("连接成功");
            };
            ws.onmessage = function(e) {
                console.log(e.data);
                if(e.data == 'close'){
                    $("#code").hide(5000);
                }
                
            };
            
        })
    </script>
</body>
</html>